package com.ruoyi.user.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.user.mapper.UserConcernMapper;
import com.ruoyi.user.pojo.AppWhoHaveIsee;
import com.ruoyi.user.domain.UserConcern;
import com.ruoyi.user.service.IUserConcernService;

/**
 * 用户关注Service业务层处理
 * 
 * @author DEREK
 * @date 2023-05-12
 */
@Service
public class UserConcernServiceImpl extends ServiceImpl<UserConcernMapper, UserConcern> implements IUserConcernService 
{
    @Autowired
    private UserConcernMapper userConcernMapper;

    /**
     * 查询用户关注
     * 
     * @param id 用户关注主键
     * @return 用户关注
     */
    @Override
    public UserConcern selectUserConcernById(Long id)
    {
        return userConcernMapper.selectUserConcernById(id);
    }

    /**
     * 查询用户关注列表
     * 
     * @param userConcern 用户关注
     * @return 用户关注
     */
    @Override
    public List<UserConcern> selectUserConcernList(UserConcern userConcern)
    {
        return userConcernMapper.selectUserConcernList(userConcern);
    }

    /**
     * 新增用户关注
     * 
     * @param userConcern 用户关注
     * @return 结果
     */
    @Override
    public int insertUserConcern(UserConcern userConcern)
    {
        userConcern.setCreateTime(DateUtils.getNowDate());
        return userConcernMapper.insertUserConcern(userConcern);
    }

    /**
     * 修改用户关注
     * 
     * @param userConcern 用户关注
     * @return 结果
     */
    @Override
    public int updateUserConcern(UserConcern userConcern)
    {
        userConcern.setUpdateTime(DateUtils.getNowDate());
        return userConcernMapper.updateUserConcern(userConcern);
    }

    /**
     * 批量删除用户关注
     * 
     * @param ids 需要删除的用户关注主键
     * @return 结果
     */
    @Override
    public int deleteUserConcernByIds(Long[] ids)
    {
        return userConcernMapper.deleteUserConcernByIds(ids);
    }

    /**
     * 删除用户关注信息
     * 
     * @param id 用户关注主键
     * @return 结果
     */
    @Override
    public int deleteUserConcernById(Long id)
    {
        return userConcernMapper.deleteUserConcernById(id);
    }

	@Override
	public IPage<AppWhoHaveIsee> myFollowOrFans(Page<AppWhoHaveIsee> page,Long userId, Integer type, Integer pageNo) {
		return userConcernMapper.myFollowOrFans(page,userId, type, pageNo);
	}
}
